<template>
  <div>
    <h1>Home组件</h1>
    <hr />
    <button @click="game">游戏</button>
    <button @click="movie">电影</button>
    <button @click="news">新闻</button>

    <hr />
    <button @click="gamereplace">游戏replace</button>
    <button @click="moviereplace">电影replace</button>
    <button @click="newsreplace">新闻replace</button>
    <hr />
    <button @click="$router.go(2)">前进2</button>
    <button @click="$router.back()">前进</button>
    <button @click="$router.forward()">后退</button>

    <router-view></router-view>
  </div>
</template>
<script>
export default {
  name: "Home",
  methods: {
    game() {
      this.$router.push("/home/game");
    },
    movie() {
      this.$router.push({
        path: "/home/movie",
      });
    },
    news() {
      this.$router.push("/home/news");
    },
    gamereplace() {
      this.$router.replace("/home/game");
    },
    moviereplace() {
      this.$router.replace({
        path: "/home/movie",
      });
    },
    newsreplace() {
      this.$router.replace({
        name: "news",
      });
    },
  },
};
</script>

<style></style>
